All Questions
Tagged with rusterror-handling
15 questions
1vote
0answers
55views
Simple CRUD server in rust
This is my first rust application. I tried to pick somewhat low level dependencies to get a feel for the language particulars. I'm especially interested in control flow/error patterns in rust as I ...
2votes
1answer
251views
A simple parser for bencoding format
I have been learning rust sporadically for a while now and decided to write some toy projects. While browsing https://github.com/codecrafters-io/build-your-own-x I came across some bittorrent client ...
1vote
1answer
89views
Unit tests for PNGme steganography exercise in Rust
I want to become proficient in Rust and I've followed the PNGme exercise. I've completed it up until Chapter 4 included, where I've written a lot of tests myself for verifying that the command line ...
4votes
1answer
53views
Parsing a u8 separated vector of FromStr from a BufRead
I need to read a vector of e.g. integers from a stream, usually from stdin but sometimes also from a file. The input is always less than a megabyte, and is sometimes separated by commas and sometimes ...
2votes
0answers
75views
Building a GTD Productivity App Designed through Test Driven Development (TDD)
First, thanks so much for looking at my code. Over the past decade, I have tried every task management apps imaginable. I finally realized that the only way I would ever find my perfect productivity ...
8votes
2answers
1kviews
Solution to the Rustlings from_into exercise
I've got a working solution to the Rustlings from_into exercise (i.e. the code compiles and all the tests pass). The task required that I implemented the From trait ...
3votes
0answers
104views
HTTP download function in Rust (async/await)
Why am I fighting the compiler? - Wrote this, which works, but I feel like I'm breaking every rule in the book: ...
3votes
0answers
52views
Connect to a database with Diesel
New to Rust and would like some clarification on idiomatic and readable use of Result and Error types. Here I'm simply connecting to a database using Diesel. In my opinion, the use of match and Boxing ...
3votes
0answers
268views
A tree command written in Rust - Error Handling
I am trying to learn Rust as my third main language (Coming from Java/Kotlin and Javascript/Node). For that purpose I reimplemented the Linux tree command. Not ...
5votes
1answer
2kviews
Read contents of file with appropriate error handling (Rust)
I am trying to learn basic Rust. Is this a good way to get the contents of a file? Am I handling errors the best way? Is there any way this could be more performant? ...
4votes
1answer
708views
Calculate mean, median, and mode from list of integers
I am trying to solve a problem put in The Rust Programming Language #2 Given a list of integers, use a vector and return the mean (average), median (when sorted, the value in the middle position), ...
3votes
0answers
243views
Easy error handling
I've started using the following Error configuration for some simple libraries I've been working on: ...
2votes
1answer
548views
Simplified error handling when reading from stdin and parsing to a type
I've recently started learning Rust, and I've managed to whip up this function, which reads and parses a thing from stdin. I don't like it though, and I feel it ...
5votes
2answers
714views
Netscape bookmark file generator
I started to learn Rust some time ago and I wonder if there is some way to write Rust code that is both concise and safe — in particular, avoiding unwrap(), casting ...
24votes
1answer
684views
Wanted a cat. Got lolcat
Wanna learn Rust? Ya rly! I can haz FizzBuzz? No wai! Gimme /bin/cat then. But rustc say LOL! Must handle teh err0rz! Now iz ...